<template>

  <PrintBox :data="item" :id="item.xieYiShuHao" v-if="printShow">
    <template #default="{ disabled }">
      <el-button type="primary" v-if="isButton" :disabled="disabled">{{ title }}</el-button>
      <el-link v-else :disabled="disabled">{{ title }}</el-link>
    </template>
    <template #item="{ printRow }">
      <h2 class="text-center m-b-12">库存交货单</h2>
      <el-descriptions title="" border :column="1">
        <el-descriptions-item label="客户名称">{{ item.customerName }}</el-descriptions-item>
        <el-descriptions-item label="订单单号">{{ item.saleOrderGroupNumber }}</el-descriptions-item>
        <el-descriptions-item label="协议书号">{{ printRow.xieYiShuHao }}</el-descriptions-item>
        <el-descriptions-item label="产品名称">{{ printRow.orderProduct?.productName
        }}</el-descriptions-item>
        <el-descriptions-item label="产品编号">{{ printRow.orderProduct?.productNumber
        }}</el-descriptions-item>
        <el-descriptions-item label="产品类型">{{ printRow.orderProduct?.productTypeName
        }}</el-descriptions-item>
        <el-descriptions-item label="产品尺寸">{{ printRow.orderProduct?.productSize
        }}</el-descriptions-item>
        <el-descriptions-item label="产品数量">{{ printRow.productQuantity }}{{
          printRow.orderProduct.productUnit
        }}</el-descriptions-item>
        <el-descriptions-item label="交货日期">{{ proxy.$day(printRow.deliveryDate)
        }}</el-descriptions-item>
        <el-descriptions-item label="下单人员">{{ item.creatorName }}</el-descriptions-item>
        <el-descriptions-item label="打印时间">{{ proxy.$day(new Date()) }}</el-descriptions-item>
        <el-descriptions-item label="打印人员">{{ proxy.$user?.userName }}</el-descriptions-item>
      </el-descriptions>
    </template>
  </PrintBox>
</template>

<script setup lang="ts">
import './pageCss.scss'; // 引入样式
const { proxy } = getCurrentInstance() as any;
import { useRoute } from 'vue-router';
const route = useRoute();
const props = withDefaults(
  defineProps<{
    title?: string; //
    item?: any; //
    isButton?: boolean; //
  }>(),
  {
  },
);
const printShow = ref(true);
watch(() => props.item?.xieYiShuHao, (newVal, oldVal) => {
  printShow.value = false
  nextTick(() => {
    printShow.value = true
  })
});

</script>
